
#include "stdafx.h"

TEST(shutdownTest, shutdown_in_inout)
{
    SOCKET sock = INVALID_SOCKET;
    
    Header header(GetCurrentThreadId(), "shutdown");
    shutdown_in_inout shutdownIN(sock, SD_BOTH);
    shutdown_in_inout shutdownOUT;

    std::vector<char> buffer;
    Serialize(header, shutdownIN, buffer);
        
    Deserialize deserialize(buffer);
    deserialize(shutdownOUT);

    EXPECT_EQ (header.TID_, deserialize.get_header().TID_);
    EXPECT_EQ (header.func_name_, deserialize.get_header().func_name_);

    EXPECT_EQ (shutdownIN.s_, shutdownOUT.s_);
    EXPECT_EQ (shutdownIN.how_, shutdownOUT.how_);
}

//TEST(shutdownTest, shutdown_in_inout_NULL_parameters)
//{
//    
//}

TEST(shutdownTest, shutdown_out_inout)
{
    SOCKET sock = INVALID_SOCKET;
    
    Header header(GetCurrentThreadId(), "shutdown");
    shutdown_out_inout shutdownIN(7);
    shutdown_out_inout shutdownOUT;

    std::vector<char> buffer;
    Serialize(header, shutdownIN, buffer);
        
    Deserialize deserialize(buffer);
    deserialize(shutdownOUT);

    EXPECT_EQ (header.TID_, deserialize.get_header().TID_);
    EXPECT_EQ (header.func_name_, deserialize.get_header().func_name_);

    EXPECT_EQ (shutdownIN.wsa_last_error_, shutdownOUT.wsa_last_error_);
}

//TEST(shutdownTest, shutdown_out_inout_NULL_parameters)
//{
//    
//}